package com.androidag;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

public class AgentesSQLiteOpenHelper extends SQLiteOpenHelper {

	//Sentencia SQL para crear la tabla de Agentes
    String sqlCreate = "CREATE TABLE Agentes (codigo INTEGER, " +
    		                                " nombre TEXT, " +
    		                                " email TEXT, " +
    		                                " PRIMARY KEY (codigo))";
	
	public AgentesSQLiteOpenHelper(Context context, String name, CursorFactory factory, int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase arg0) {
		arg0.execSQL(sqlCreate);
	}

	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
		arg0.execSQL("DROP TABLE IF EXISTS Agentes");
		arg0.execSQL(sqlCreate);
	}

}
